package com.tql.mall.web.controller;

import com.tql.mall.common.constant.PageConstant;
import com.tql.mall.model.order.OrderInfo;
import com.tql.mall.order.client.OrderFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @Author: tyk
 * @Date: 2023/5/27 16:52
 * @Description:
 */
@Controller
public class PaymentWebController {

    @Autowired
    private OrderFeignClient orderFeignClient;

    /**
     * 订单等待支付界面
     */
    @GetMapping("pay.html")
    public String pay(Long orderId, Model model) {
        OrderInfo orderInfo = orderFeignClient.getOrderInfo(orderId);
        model.addAttribute(PageConstant.ORDER_INFO, orderInfo);
        return "payment/pay";
    }

    @GetMapping("payResult.html")
    public String payResult(Long orderId, Model model) {
        return "payment/success";
    }


}
